// ============================== 导入依赖 ============================== //

import Vue from 'vue'
import Vuex from 'vuex'
import VueRouter from 'vue-router'

Vue.use(Vuex)
Vue.use(VueRouter)

const imports = require.context('./', false, /[A-Z]+\.js/)
const STORE = imports.keys().reduce((obj, path) => {
  const folderIndex = /^\.\/([A-Z]+)\.js$/.exec(path)
  if (folderIndex) obj[folderIndex[1]] = imports(path).default
  return obj
}, {})

// ============================== 导出仓库 ============================== //

export default STORE
